Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test concurrent feecurrency tx handling in tx pool #2333

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

piersy
Copy link
Contributor

@piersy piersy commented Nov 1, 2024

Adds a test to verify that the tx pool is executing concurrent fee currency checks safely.

I created this to see if I could reproduce #2318 but I was unable to reproduce that issue. It did however uncover a different race condition, which was that core.current was being set in one goroutine and accessed from others without synchronisation. This was easy to fix by just locking around the point where it is set.

Copy link

github-actions bot commented Nov 1, 2024

Coverage from tests in ./e2e_test/... for ./consensus/istanbul/... at commit 8e9ec54

coverage: 55.4% of statements across all listed packages
coverage:  68.6% of statements in consensus/istanbul
coverage:  63.6% of statements in consensus/istanbul/announce
coverage:  57.6% of statements in consensus/istanbul/backend
coverage:   0.0% of statements in consensus/istanbul/backend/backendtest
coverage:  24.3% of statements in consensus/istanbul/backend/internal/replica
coverage:  66.6% of statements in consensus/istanbul/core
coverage:  50.0% of statements in consensus/istanbul/db
coverage:   0.0% of statements in consensus/istanbul/proxy
coverage:  64.2% of statements in consensus/istanbul/uptime
coverage:  52.4% of statements in consensus/istanbul/validator
coverage:  79.2% of statements in consensus/istanbul/validator/random

Copy link

github-actions bot commented Nov 1, 2024

5890 passed, 45 skipped

Copy link
Contributor

@gastonponti gastonponti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
The only doubt I have, is that you are sending the txs from the same N accounts, and I thought that every txpool had a maximum amount of txs per account in a pending state, so I would have guess that it was going to fail due to that limitation, but it seems that works, so maybe was configured to not have a cap before?

@piersy
Copy link
Contributor Author

piersy commented Nov 1, 2024

@gastonponti Good point, that is strange there is a limit (see below), and the default which is used in the test is 64, so I'd really expect this test to at least be flaky if not fail all the time, but even running with a block time of 20 seconds, which means all txs will have been sent and in the tx pool before a block is constructed (300 txs per account) it still passes!

So I guess there is some understanding we are missing, anyway I've updated the tx sending to try and not overload the account queue.

AccountSlots uint64 // Number of executable transaction slots guaranteed per account

Increased time between transactions sending so that accounts don't send
more than 64 txs within the block period.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants